package javabase.exception.Exit;

import java.io.FileOutputStream;
import java.io.IOException;

public class ExitFinally {

	public ExitFinally() {
		
	}

	public static void main(String[] args) throws IOException {
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream("a.bin");
			System.out.println("程序打开物理资源");
//			int a = 6/0;
//			System.out.println("i的值：" + a);
			System.exit(0);
			System.out.println("程序执行了System.exit(0)");
			int a = 6/0;
			System.out.println("i的值：" + a);
		} finally {
			if (fos != null) {
				try {
					fos.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
				System.out.println("程序关闭了物理资源");
			}
		}
	}

}
